/**
 * @name basic-block-connect
 * @id python/basic-block-connect
 */

import python
import util

// from BasicBlock b1, BasicBlock b2
// where 
// b1 != b2 and 
// b2=b1.getImmediateDominator()

// select b1, b2
from File f,BasicBlock start,BasicBlock end,Scope scope,string start_location,string end_location,string filepath,string start_node_type,string start_node_value,string end_node_type,string end_node_value,
string start_node_location,string end_node_location
where
scope=start.getScope()
and
prepare_basicblock_node_id(start, start_node_type, start_node_value, filepath, start_node_location, start_location)
and
prepare_basicblock_node_id(end, end_node_type, end_node_value, filepath, end_node_location, end_location)
and
prepare_cfg_node_id(start.getLastNode(), start_node_type, start_node_value, start_node_location)
and
prepare_cfg_node_id(end.getLastNode(), end_node_type, end_node_value, end_node_location)
and
f=scope.getEnclosingModule().getFile()
and
end=start.getASuccessor()
and
isSource(f)
select start,end,filepath,scope,start_node_type,start_node_value,end_node_type,end_node_value,start_location,end_location,start_node_location,end_node_location